# print("晟尧赢了！")
# print("湘飞赢了！")
from random import randint

G_num = 0
G_num2 = 0
G_num3 = 0

def start():
    global G_num
    global G_num2
    global G_num3
    G_num = 0
    G_num2 = 0
    G_num3 = 0
    nn = 0
    while nn < 10:
        print("================第 " + str(nn+1) + " 局====================================")
        wo = input("请输入你的选择：0-石头； 1-剪刀； 2-布：（只要输入数字就行）：    ")
        judge(int(wo))
        nn += 1
        print("\n\n这是第"+ str(nn) + "局\n当前你已经赢了 " + str(G_num) + " 次！  " + "  电脑赢了" + str(G_num2) + "次！"  + "  平了" + str(G_num3) + "次！\n")
        print("~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n\n")

def judge(wo, wanjianame="晟尧"):
    global G_num
    global G_num2
    global G_num3
    arr = ["石头", "剪刀", "布"]
    wo = arr[wo]
    diannao = diannaore()
    result = rules(diannao, wo, wanjianame)
    if  result == "win":
        G_num += 1
    elif result == "fail":
        G_num2 += 1
    else:
        G_num3 += 1 ##平局



def diannaore():
    n = randint(0,2)
    arr = ["石头", "剪刀", "布"]
    return arr[n]

def rules(diannao, wo, wanjianame):
    if diannao == "石头" and wo == "石头":
        print("这一局是平局！                                电脑出的是："+diannao + "         您出的是："+wo)
        return "pingju"

    if diannao == "石头" and wo == "布":
        print("恭喜您！！！" + wanjianame + "赢了！           电脑出的是："+diannao + "        您出的是："+wo)
        return "win"

    if diannao == "石头" and wo == "剪刀":
        print("这一局是电脑赢了，您输了！                      电脑出的是："+diannao + "           您出的是："+wo)
        return "fail"

    if diannao == "布" and wo == "布":
        print("这一局是平局！                                  电脑出的是："+diannao + "            您出的是："+wo)
        return "pingju"

    if diannao == "布" and wo == "剪刀":
        print("恭喜您！！！" + wanjianame + "赢了！             电脑出的是："+diannao + "             您出的是："+wo)
        return "win"

    if diannao == "布" and wo == "石头":
        print("这一局是电脑赢了，您输了！                        电脑出的是："+diannao + "              您出的是："+wo)
        return "fail"

    if diannao == "剪刀" and wo == "剪刀":
        print("这一局是平局！                                   电脑出的是："+diannao + "                 您出的是："+wo)
        return "pingju"

    if diannao == "剪刀" and wo == "石头":
        print("恭喜您！！！" + wanjianame + "赢了！              电脑出的是："+diannao + "                   您出的是："+wo)
        return "win"

    if diannao == "剪刀" and wo == "布":
        print("这一局是电脑赢了，您输了！                        电脑出的是："+diannao + "                      您出的是："+wo)
        return "fail"
